//
//  HotTravellTableViewCell.m
//  AroundTheWorld
//
//  Created by dllo on 16/5/17.
//  Copyright © 2016年 IfelseGo an. All rights reserved.
//

#import "HotTravellTableViewCell.h"

@implementation HotTravellTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addView];
    }
    return self;
}
- (void)addView
{
    self.contentView.dk_backgroundColorPicker = DKColorPickerWithRGB(0xffffff,0xCFCFCF);
    self.photoImageV = [self addImageView];
    self.ViewsImageV = [self addImageView];
    self.LikesImageV = [self addImageView];
    
    self.titileLabel = [self addLabel];
    self.titileLabel.text = @"titil";
    self.titileLabel.numberOfLines = 0;
    self.titileLabel.textColor = [UIColor blackColor];
    self.titileLabel.font = [UIFont systemFontOfSize:15];
    
    self.userNameLabel = [self addLabel];
    self.userNameLabel.text = @"userName";
    self.ViewsLabel = [self addLabel];
    self.ViewsLabel.text = @"Views";
    self.LikesLabel = [self addLabel];
    self.LikesLabel.text = @"Likes";
    
    self.ViewsImageV.image = [UIImage imageNamed:@"icon-eye32x32.png"];
    self.LikesImageV.image = [UIImage imageNamed:@"icon-duihuakuang32x32.png"];
}

//addButton
- (UILabel *)addLabel
{
    UILabel *label = [[UILabel alloc] init];
    label.textColor = [UIColor grayColor];
    label.font = [UIFont systemFontOfSize:12];
//    label.font = [UIFont fontWithName:@"Hiragino" size:12.f];
    [self.contentView addSubview:label];
    return label;
}
- (UIImageView *)addImageView
{
    UIImageView *imageV = [[UIImageView alloc] init];
    imageV.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:imageV];
    return imageV;
    
}
//分布
- (void)layoutSubviews
{
    [super layoutSubviews];
    self.photoImageV.frame = CGRectMake(7, 5, 120, 87);
    self.ViewsImageV.frame = CGRectMake(140, 75, 17, 17);
    self.LikesImageV.frame = CGRectMake(230, 75, 15, 15);
    
    self.titileLabel.frame = CGRectMake(140, 5, 255, 45);
    self.userNameLabel.frame = CGRectMake(140, 50, 255, 20);
    self.ViewsLabel.frame = CGRectMake(160, 75, 50, 15);
    self.LikesLabel.frame = CGRectMake(250, 75, 50, 15);
 }

- (void)setHotModel:(HotTravelNotesModel *)hotModel
{
    _hotModel = hotModel;
    self.titileLabel.text = _hotModel.title;
    self.ViewsLabel.text = [NSString stringWithFormat:@"%ld",(long)_hotModel.views];
    self.LikesLabel.text = [NSString stringWithFormat:@"%ld",(long)_hotModel.replys];
    self.userNameLabel.text = _hotModel.username;
    [self.photoImageV sd_setImageWithURL:[NSURL URLWithString:_hotModel.photo] placeholderImage:[UIImage imageNamed:@""]];
   }

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
